public class ToString {
    int[] arr;
    private int capacity;
    private int count;

    public ToString() {
        count = -1;
    }

    public ToString(int capacity) {
        this.capacity = capacity;
        arr = new int[capacity];
        count = 0;
    }
    public void add(int value){
        arr[count++] = value;
    }

    @Override
    public String toString() {
        if(count == 0){
            return "[]";
        }
        if(count > 0){
            String ans = "[";
            for (int i = 0; i < count-1; i++) {
                ans += arr[i];
                ans += ",";
            }
            ans += arr[count-1];
            ans += "]";
            return ans;
        }
        return null;
    }
}
